home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / MM2_DEV / S / TEST / MINTBUG2.M < prev    next >
Encoding:
Text File  |  1992-02-19  |  1.3 KB  |  52 lines

  1. MODULE MiNTBug2;
  2. (*$C-,N+,R-,L-*)
  3.  
  4. (*
  5.  * this program shows, that after a Pterm() call even an additional Pterm()
  6.  * call will not override the exit code: the exit code of the first Pterm
  7.  * is returned instead of the latter exit code.
  8.  * if it would run correctly, the exitcode would be 4567. instead, it is 1234.
  9.  *
  10.  * NOTE: link with no additional startup code!
  11.  *)
  12.  
  13. FROM SYSTEM IMPORT ASSEMBLER;
  14.  
  15. BEGIN
  16.   ASSEMBLER
  17.         ;illegal         ; to call resident debugger (e.g. templemon)
  18.         
  19.         ; go into supervisor mode
  20.         clr.l   -(a7)
  21.         move    #$20,-(a7)
  22.         trap    #1
  23.         
  24.         ; install 'catch' in etv_term
  25.         lea     _term(pc),a0
  26.         move.l  $408,(a0)
  27.         lea     catch(pc),a0
  28.         move.l  a0,$408
  29.         
  30.         ; do Pterm(1234)
  31.         move    #1234,-(a7)
  32.         move    #$4c,-(a7)
  33.         trap    #1              ; execution will continue at 'catch'...
  34.         
  35. catch:  ;illegal         ; to call resident debugger (e.g. templemon)
  36.         
  37.         ; restore etv_term
  38.         move.l  _term(pc),$408
  39.         
  40.         ; do Pterm(4567)
  41.         move    #4567,-(a7)
  42.         move    #$4c,-(a7)
  43.         trap    #1
  44.  
  45. test:   ; do nothing
  46.         rts
  47.  
  48. _term:  dc.l    0               ; to save ($408)
  49.  
  50.   END
  51. END MiNTBug2.
  52.